package com.community.process._1010.domains;

import com.community.process._1010.common.api.InPage;
import com.community.process._1010.dao.entity.ProcessIngredients;
import com.community.process._1010.dao.vo.ProcessIngredientsVo;
import com.oneadds.lowcode.BaseQuery;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.validation.constraints.*;
import java.math.BigDecimal;
import java.util.List;

/**
 * @Description: 食材
 * @Author: Administrator to Zbs
 * @Date: 2024/9/6 星期五 13:32
 */
public class ProcessIngredientsDTO {

    /**
     * 需要支持名词模糊查询
     * 分类ID查询
     * 分类树code查询 右模糊查询
     */
    @Getter
    @Setter
    public static class IngredientsPageSearch extends InPage {

        @Schema(description = "食材名称")
        private String name;

        @Schema(description = "分类ID")
        private Long categoryId;

        @Schema(description = "分类树的tree code")
        private String categoryTreeCode;

        @Schema(description = "上下架 1 上架 0 下架")
        private Integer up;
    }

    @Getter
    @Setter
    public static class IngredientsBase {
        @Schema(description = "食材名称")
        @NotBlank(message = "食材名称不能为空")
        private String name;

        @Schema(description = "分类ID")
        @NotNull(message = "分类ID不能为空")
        private Long categoryId;

        @Schema(description = "组合最小数量")
        @NotNull(message = "最小数量不能为空")
        @Min(value = 1, message = "最小数量不能小于1")
        private Integer min;

        @Schema(description = "组合最大数量")
        @NotNull(message = "最大数量不能为空")
        @Min(value = 1, message = "最小数量不能小于1")
        private Integer max;

        @Schema(description = "食材图片(1张图片)")
        @NotBlank(message = "食材图片不能为空")
        private String image;

        @Schema(description = "食材最小单位加工费 单位：元")
        @NotNull(message = "价格不能为空")
        private BigDecimal processingFee;

        @Schema(description = "食材最小单位售卖价格 单位：元")
        @NotNull(message = "价格不能为空")
        private BigDecimal price;

        @Schema(description = "单位")
        @NotBlank(message = "单位不能为空")
        private String units;

        @Schema(description = "单位数量")
        @NotNull(message = "单位数量不能为空")
        private Integer unitsNum;
    }

    @Getter
    @Setter
    public static class IngredientsAdd extends IngredientsBase {

    }

    @Getter
    @Setter
    public static class IngredientsUpdate extends IngredientsBase {
        /**
         * ID
         */
        @Schema(description = "ID",requiredMode = Schema.RequiredMode.REQUIRED)
        @NotNull(message = "ID不能为空")
        private Long id;

        @Schema(description = "上下架 1 上架 0 下架")
        @NotNull(message = "上下架状态不能为空")
        private Integer up;
    }

    @Getter
    @Setter
    public static class IngredientsDelete {
        /**
         * ID
         */
        @Schema(description = "ID",requiredMode = Schema.RequiredMode.REQUIRED)
        @NotEmpty(message = "ID不能为空")
        private List<Long> ids;
    }

    /**
     * 批量上下架
     */
    @Getter
    @Setter
    public static class IngredientsSetUp {
        /**
         * ID
         */
        @Schema(description = "ID",requiredMode = Schema.RequiredMode.REQUIRED)
        @NotEmpty(message = "ID不能为空")
        private List<Long> ids;

        @Schema(description = "上下架 1 上架 0 下架")
        @NotNull(message = "上下架状态不能为空")
        private Integer up;
    }
}
